package com.jikexueshe.crm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jikexueshe.crm.mapper.CStaffMapper;
import com.jikexueshe.crm.pojo.CStaff;
import com.jikexueshe.crm.service.StaffService;

@Service
public class StaffServieImpl implements StaffService {
	
	@Autowired
	private CStaffMapper staffMapper;

	@Override
	public void save(CStaff t) {
		staffMapper.insert(t);
	}

	@Override
	public void delete(Integer id) {
		staffMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void update(CStaff t) {
		staffMapper.updateByPrimaryKey(t);
	}

	@Override
	public PageInfo<CStaff> select(Integer page,Integer rows,CStaff t) {
		PageHelper.startPage(page,rows);
		List<CStaff> list = staffMapper.select(t);
		return new PageInfo(list);
	}

	@Override
	public CStaff getById(Integer id) {
		return staffMapper.selectByPrimaryKey(id);
	}

}
